package tree;

/**
 * @ Author     ：侯耀祖
 * @ Description：
 */
public class searchBST {
    TreeNode node = null;
    public TreeNode searchBST(TreeNode root, int val) {
        if (root == null){
            return null;
        }
        if (root.val == val){
            return root;
        }
        if (root.val > val) node = searchBST(root.left, val);
        if (root.val < val) node = searchBST(root.right, val);
        return node;
    }
}
